<?php
require_once '../include/common.inc.php';
$table="cus_members";

$sql = "select * FROM  cus_members order by id desc ";
$query = $db->query($sql);
while($rs=$db->fetch_array($query))
{
	$r[]=$rs;
}



header("Content-type:application/vnd.ms-excel");  
header("Content-Disposition:filename=Customer_Info_" . date("Ymd") . ".xls");  

echo "Code \t";
echo "Username \t";
echo "Password \t";
echo "Email \t";
echo "Company \t";
echo "First Name \t";
echo "Last Name\t";
echo "Address \t";
echo "Street \t";
echo "City \t";
echo "State \t";
echo "Zip \t";
echo "Country \t";
echo "Phone \t";
echo "Mobile \t";
echo "Fax \t";
echo "Delivery Address \t";
echo "Delivery Street \t";
echo "Delivery City \t";
echo "Delivery State \t";
echo "Delivery Zip \t";
echo "Delivery Country \t";
echo "Date\t";
echo "Accept Newsletter\t\n";

for ($i=0;$i<count($r);$i++){

echo replaceHtmlAndJs($r[$i]['id']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['username']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['password2']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['email']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['company']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['firstname']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['lastname']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['address']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['street']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['city']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['state']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['zip']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['country']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['phone']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['mobile']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['fax']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['address2']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['street2']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['city2']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['state2']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['zip2']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['country2']  ). "\t"; 
echo replaceHtmlAndJs(date("Y-m-d",$r[$i]['date'])). "\t";

if ($r[$i]['faq2']=="1") echo "yes\t\n"; else echo "no\t\n";
}

echo "\n"; 

?>


